<link rel="stylesheet" type="text/css" href="../addons/jy_supplier/css/common.css?v=2016063000">
<style>
    .fui-list-group{
        margin-top: 0;
    }
</style>
<div class="fui-page page-merch-list">
    <div class="fui-header">
        <div class="fui-header-left"></div>
        <div class="title">首页</div>
        <div class="fui-header-right"></div>
    </div>
    <div class="fui-content" style="bottom: 2.4rem">
        <div class="fui-searchbar bar">
                <div class="searchbar center">
                   
                    <div class="search-input">
                        <i ng-click="getlist(pagedata.keyword)" class="icon icon-search " id='searchsub' ></i>
                        <input type="search" placeholder="输入关键字..." class="search" ng-model="pagedata.keyword" >
                    </div>
                </div>
         </div>
        <div id="carousel-container" ng-if="pagedata.pluginset.hdps.length>0" class="carousel slide" data-role="carousel" data-param-auto="true">
			<div class="carousel-inner" role="listbox" style="height:6rem">
				<div ng-class="{'item':1,'active':$index==0}" ng-repeat="item in pagedata.pluginset.hdps">
					<a href="#">
						<img src="{{tomedia(item.picurl) || '../core/resource/images/banner-1.jpg'}}" style="display: block; width: 100%; height: 100%;">
					</a>
				</div>
			</div>
			<style>
					.fui-swipe-page .fui-swipe-bullet {background: {background}; opacity: {opacity};}
					.fui-swipe-page .fui-swipe-bullet.active {opacity: 1;}
			</style>
			<div id="carousel-jinyun" class="fui-swipe-page" style="padding: 0 5px; bottom: 10px; ">
				<div class="fui-swipe-bullet" ng-repeat="item in pagedata.pluginset.hdps" ng-class="{'active':$index==0}" data-target="#carousel-container" data-slide-to="{{$index}}"></div>
			</div>
		</div>

       <div ng-if="pagedata.cate!='' && pagedata.cate!=null">
		<!--	<div class="fui-cell-group qa-title">
				<div class="fui-cell">
					<div class="fui-cell-text">推荐分类</div>
					<a class="fui-cell-remark external" ng-click="access_json('/cotegory/')">全部</a>
				</div>
			</div>
			<div ng-repeat="item in pagedata.cate" class="fui-icon-group col-4 noborder">
			   
				<a class="fui-icon-col external" ng-click="access_json('/merch//cateid='+item.id)">
					<div class="icon">
						<img src="{{tomedia(item.image) || '../core/resource/images/nopic.jpg'}}"/>
					</div>
					<div class="text">{{item.catename}}</div>
				</a>
				
			</div>-->
         </div>
        <div class="fui-cell-group qa-title">
            
        </div>
        <div class="fui-goods-group block" id='container'>
	<div ng-repeat="g in pagedata.list" id="goodslist" class="fui-goods-item">
					<a ng-click="access_json('jy_supplier/goods_detail//id='+g.id)">
						<div class="image" style="background-image:url('{{tomedia(g.image) || '../core/resource/images/nopic.jpg'}}')">
							<div ng-if="g.total<=0" class="salez" style="background-image: url('{{tomedia(pagedata.shopset.saleout)}}'); "></div>
						</div>
					</a>
					<div class="detail">
						<a ng-click="access_json('jy_supplier/goods_detail//id='+g.id)">
							<div class="name">{{g.title}}</div>
						</a>
						<div class="price">
							<span class="text">￥{{g.price}}</span>
							
						</div>
					</div>
	</div>
	</div>
    </div>

</div>
<script type="text/javascript">
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
scope.loading = true;
    // 百度地图API功能
	window.scope.location(function(re){
	
	var data={
	'data':re.lat_lng,
	'op':'list',
	};
	data.callback=function(d){
	
		window.scope.pagedata.list=d.list;
		scope.loading = false;
		scope.$apply();
	}
	window.scope.post_json(data);
	});
	
	scope.scroll(function(){
		scope.$apply();
		setTimeout('getlist()',2000);
	},false,'svposttext');
	var page = 1;
	scope.getlist=function (key){
		var params = {
					'plugin':'jy_supplier',
					'action':'index',
					'op':'list',
					'data':{
						'keyword':key,
					},
					'callback':function(data){
							if(data.error !=1){
							 for (var i=0;i<data.list.length;i++){
									scope.pagedata.list.push(data.list[i]);
								}
								if(page >1){
									$(".merchgroup").animate({scrollTop:0},300);
								}
								page++;
								scope.loading = false;
								window.scope.pagedata.list=data.list;
								scope.$apply();
							}else{
								onsole.log('error');
							};
					}
		}
		scope.post_json(params);
}

   
</script>